<script>
import axios from 'axios'
export default {
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods: {
    async handleSubmit() {
      const result = await axios.post('http://localhost:3000/users', {
        username: this.username,
        password: this.password
      })
    
      // const result2 = await axios.get('http://localhost:3000/list')
      // console.log(result2)

      // const result3 = await axios.delete('http://localhost:3000/list/001')
      // console.log(result3)

      // const result4 = await axios.put('http://localhost:3000/list/003', {
      //   price: 200,
      //   id: '003',
      //   name: 'a shoes'
      // })

      const result5 = await axios.patch('http://localhost:3000/list/004', {
        price: 2000,
      })
      console.log(result5)
    }
  }
}
</script>

<template>
  <div>
    <form @submit.prevent="handleSubmit">
      用户名：<input type="username" v-model="username"><br/>
      密码：<input type="password" v-model="password"><br/>
      <button>提交</button>
    </form>
  </div>
</template>

<style lang="scss">
  
</style>
